using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BlogEngine.Core.Providers;
using BlogEngine.Core;

public partial class gallery_addlocalphotos : System.Web.UI.Page
{
	protected Guid guid;

	protected void Page_Load(object sender, EventArgs e)
	{
		guid = new Guid(Request.QueryString["AlbumId"]);
		btnImportFiles.Click += new EventHandler(btnImportFiles_Click);
	}

	#region Event Handlers

	/// <summary>
	/// Imports all the files in the import directory
	/// </summary>
	private void btnImportFiles_Click(object sender, EventArgs e)
	{
		if (!Page.IsValid)
			throw new InvalidOperationException("One or more validators are invalid.");

		if (!Photo.BulkImport(Album.GetById(guid), txtTags.Text, cdDelete.Checked))
			throw new InvalidOperationException("An error occurred during upload.");

		//Photo.UpdateAllMetaData();

		Response.Redirect("ViewPhotoAlbum.aspx?AlbumId=" + guid.ToString());
	}

	#endregion


}
